Skip to main content

All Questions

5votes
1answer
12kviews

Using singletons in Python (Django)

I was suggested to define a singleton in Python in the following way: class Controller: pass # ... controller = Controller() However, this way, controller cannot be replaced with a derived ...
porton's user avatar
1vote
1answer
3kviews

Is using __import__('module_name') an antipattern in Python?

I'm currently refactoring a Python 2 project which includes the ability to add or remove plugins, which are Python modules implementing a given API. The main app accesses add/remove/update hooks in ...
Jules's user avatar
13votes
4answers
7kviews

Global request context - anti-pattern?

I was talking today to a colleague of mine about Python web frameworks and our impressions about them. I told him I think Flask having a global request smells badly and is an anti-pattern. The docs ...
warvariuc's user avatar

close